﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySql.Data.MySqlClient;

/// <summary>
/// Summary description for Companies
/// </summary>
public class AutoCompCompanies
{
  private const string SP = "Company_AutoCompleteList";
  private DatabaseManager db;
  private MySqlDataReader reader;

  public string Comp { get; set; }

  public AutoCompCompanies()
  {
    db = new DatabaseManager();
  }

  public List<string> Load(string Prefix)
  {
    List<string> cl = new List<string>();
    db.AddParameter("@_prefix", Prefix);
    using (reader = db.ExecuteStoredProcedure(SP))
    {
      while (reader.Read())
      {
        cl.Add(reader["name"].ToString()) ;
      }
    }
    return cl;
  }
}